import {SAVE_USER_AND_TOKEN,LOGIN_OUT_USER_AND_TOKEN} from '../constant';
export const saveUserAndToken = (value) => {
	//存储用户信息，token和登陆状态
	localStorage.setItem('user',JSON.stringify(value.user))
	localStorage.setItem('token',value.token)
	localStorage.setItem('isLogin',true)
	
	return {type: SAVE_USER_AND_TOKEN, data:value}
}
	
export const loginOutUserAndToken = (value) => {
	//存储用户信息，token和登陆状态
	localStorage.removeItem('user')
	localStorage.removeItem('token')
	localStorage.setItem('isLogin',false)
	
	return {type: LOGIN_OUT_USER_AND_TOKEN}
}
	
